import 'package:flutter/material.dart';

void main() {
  runApp(MyApp());
}

class MyApp extends StatelessWidget {
  const MyApp({super.key});

  @override
  Widget build(BuildContext context) {
    return MaterialApp(
      home: Scaffold(
        appBar: AppBar(
          title: Text("Flutter Demo", style: TextStyle(color: Colors.white)),
          backgroundColor: Colors.blue,
        ),
        body: HomePage(),
      ),
    );
  }
}

class HomePage extends StatelessWidget {
  const HomePage({super.key});

  @override
  Widget build(BuildContext context) {
    return Container(
      width: 300,
      height: 400,
      color: Colors.red,
      child: Stack( // 注意：相对于外部容易定位，如果没有外部容器，就相对于屏幕定位
        children: [
          Positioned(
            left: 10,
            bottom: 10,
            child: Container(width: 100, height: 100, color: Colors.yellow),
          ),
          Positioned(right: 0, top: 190, child: Text("你好Flutter")),
        ],
      ),
    );
  }
}
